#include <iostream>
#include <vector>

#include <algorithm>
using namespace std;

//加起来和为目标值的组合
class Solution {
public:  
    vector<vector<int>> res;
    vector<int> tmp;
    vector<vector<int>> combinationCount(int target, vector<int>& nums) 
    {
        if(nums.size()==0) return res;
        dfs(target,nums,0,0);

        return res;
    }
    void dfs(int target,vector<int>& nums,int curi,int sum)
    {
        if(sum>=target)
        {
            if(sum==target)
            {
                res.push_back(tmp);
            }
            return;
        }
        for(int i=curi;i<nums.size();i++)
        {
            tmp.push_back(nums[i]);
            dfs(target,nums,i,sum+nums[i]);
            tmp.pop_back();
        }
    }
};